This example creates a registry key, SOFTWARE\\Microsoft\\TestApp\\1.0, and sets its values.
Private Sub CreateAndSetKey
Dim regVersion As Microsoft.Win32.RegistryKey
regVersion = _
Microsoft.Win32.Registry.CurrentUser.CreateSubKey("SOFTWARE\\Microsoft\\TestApp\\1.0")
Dim newVersion As Integer = 0
If (Not regVersion Is Nothing) Then
newVersion = Microsoft.Win32.regVersion.GetValue("Version", 0)
newVersion = newVersion + 1
regVersion.SetValue("Version", newVersion)
regVersion.Close()
End If
End Sub
This example requires:
Registry calls fail if either sufficient runtime permissions are not granted
(
Code:
Creating a Key In the Registry (Visual Basic) |